#include "cpu/exec/template-start.h"

#define instr ret

make_helper(instr) {
    cpu.eip = swaddr_read(cpu.esp, 4) - 1;
    cpu.esp += 4;
    print_asm("ret");
    return 1;
}

make_helper(concat5(instr, _, i, _, w)) {
    uint16_t imm_num = instr_fetch(eip + 1, 2);
    cpu.eip = swaddr_read(cpu.esp, 4) -3;
    cpu.esp += imm_num + 4;
    print_asm("ret $0x%x", imm_num);
    return 3;
}

#include "cpu/exec/template-end.h"